﻿#ifndef DATE_H
#define DATE_H

#include <QObject>

typedef struct _CDate
{
    _CDate(int year, int month, int day)
    {
        nYear = year;
        nMonth = month;
        nDay = day;
    }

    int nYear;
    int nMonth;
    int nDay;

    _CDate& operator=(const _CDate &date)
    {
        nYear = date.nYear;
        nMonth = date.nMonth;
        nDay = date.nDay;
        return *this;
    }
}CDate, *pCDate;


class Date : public QObject
{
    Q_OBJECT
public:
    explicit Date(QObject *parent = 0);

signals:

public slots:

public:
    static quint16 getSpringFestivalDate(int year);

    static int getFirstDayOfWeek(int year, int month);
    static int getTotalMonthDays(int year, int month);
    static int getMonthDays(int year, int month);
    static bool isLoopYaer(int year);
    static QString getLunarDate(int year, int month, int day);
    static QString getLunarMonAndDay(int year, int month, int day);
    // 计算今年是什么年如 ：甲子年
    static QString getLunarTime(int year);
    static bool isHoliday(int year, int month, int day);
    static CDate ToLunar(int year, int month, int day);
    static bool isChuxi(int year, int month, int day);
    static bool isChunjie(int year, int month, int day);
    static bool isQingming(int year, int month, int day);
    static bool isDuanwu(int year, int month, int day);
    static bool isZhongqiu(int year, int month, int day);
    static CDate FindChuxi(int year);
    static CDate FindChunjie(int year);
    static CDate FindQingming(int year);
    static CDate FindDuanwu(int year);
    static CDate FindZhongqiu(int year);

private:
    static QString holiday(int month, int day);
    static QString solarTerms(int year, int month, int day);
    static QString lunarFestival(int month, int day);
};

#endif // DATE_H
